package com.framework.loippi.controller.api;

import com.framework.loippi.api.utils.ApiUtils;
import com.framework.loippi.entity.Article;
import com.framework.loippi.service.ArticleCategoryService;
import com.framework.loippi.service.ArticleService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * API - 获取文章内容接口
 *
 * @author wangcj
 * @version 2.0
 */
@Controller("apiArticleController")
public class ArticleController extends ApiBaseController {
    @Resource
    private ArticleService articleService;

    @Resource
    private ArticleCategoryService articleCategoryService;

    @RequestMapping(value = "/api/article/getArticle.json", method = RequestMethod.POST)
    public @ResponseBody
    String GetArticle(Long articleId, HttpServletRequest request, HttpServletResponse res) {
        Article article = articleService.find(articleId);
        return ApiUtils.success(article);
    }
}
